// 显示未完成todo数量
import Ember from 'ember';

/**
* 暂时弃用
*/
export default Ember.Component.extend({
    tagName: 'span',
    classNames: [ 'badge badge-transparent-black' ],
    session: Ember.inject.service('session'),

    todosForTotla: Ember.computed(function() {
      return this.store.findAll('todo-item');
  	}),

    // 4重过滤：1，状态为2；2，登录用户id；3，所属分类；4-不显示子任务
    completedTodoCount4Cmp: Ember.computed('todosForTotla.@each.userId',
                                        'todosForTotla.@each.recordStatus',
                                        'todosForTotla.@each.project', function() {
		var userId = this.get('session').get('data').authenticated.uid;
        var projCode = this.get('projCode');  //调用组件时候传递过来

        return this.get('todosForTotla').filter(function(td) {
            return td.get('recordStatus') === 2
                    && td.get('user') === userId
                    && td.get('project') === projCode;
        }).get('length');
	})
});
